function arrayTracesOfMultipleMaps(handles)
% arrayTracesOfMultipleMaps
%
% Editing:
% gs april 2005
% ------------------------------------------------

% set up the figure 
x = .14+.02; 
y = .11 - .02; 
w = .5; 
h = .8; 

% handles.data.analysis.colorOrder = ['k'; 'b'; 'g'; 'r'; 'c'; 'm'; 'y'];
% colorOrder = ['k'; 'k'; 'k'; 'k'; 'k'; 'k'; 'k'];

% copy each individual trace-map figure into one
for m = 1 : handles.data.analysis.numberOfMaps
    string = (['handles.data.map.map' num2str(m)]);
    eval(['handles.data.map.mapActive = ' string ';']);
    
    if m == 1
        c = copyobj(handles.data.map.mapActive.hTraceMapFig, 0);
        set(c, 'Position', [x y w h]);
        set(findobj(get(c, 'Children'), 'Type', 'Line'), ...
            'Color', handles.data.analysis.colorOrder(m), 'Tag', ['map' num2str(m)]);
    else
        h = get(handles.data.map.mapActive.hTraceMapFig, 'Children');
        d = copyobj(h, c);
        s = findobj(d, 'Tag', 'scaleBarLines'); % delete extra sets of scale bars
        delete(s);
        t = findobj(d, 'Tag', 'scaleBarText'); % delete extra sets of scale bar text
        delete(t);
        e = findobj(d, 'Type', 'Line');
        try
            set(e, 'Color', handles.data.analysis.colorOrder(m), 'Tag', ['map' num2str(m)]);
        catch
            set(e, 'Color', [.5 .5 .5], 'Tag', ['map' num2str(m)]);
        end
    end
end


% clean up title
h = findobj(get(c, 'Children'), 'Tag', 'singleTraceMap');
p = get(h(1), 'Parent');
delete(h);

titleStr = [handles.data.analysis.experimentName ', traces from all analyzed maps'];
text('String', titleStr, 'Units', 'Normalized', 'Position', [0 1.005], ...
    'FontSize', 12, 'FontWeight', 'Bold', 'Parent', p, ...
    'Interpreter', 'none');

